/*
 * main.c
 *
 *  Created on: Feb 17, 2013
 *      Author: justin
 */

#include "project.h"

#define spiPort1 2
/**\brief
 * This is the main test for the DDS driver unit
 *
 */
int main() {
//	_delay_ms(200);
	spiInit();
//	ad9833_init();	//wake the ad9833. clear registers
//	_delay_us(500);
//
//	ad9833_set_frequency(0,150000);	//write appropriate value to register 1 for 1MHz output
//	_delay_us(500);
//	ad9833_set_freq_out(0);			//configure registers to use freq register 1
//	_delay_us(500);
//	ad9833_set_phase(0,0);
//	_delay_us(500);
//
//	ad9833_set_mode(AD_SINE);		//set registers for sine output mode.

	ad9833_init();

	ad9833_set_frequency(0,100e3);

	//Select frequency 0 as output
	ad9833_set_freq_out(0);

	//Set output mode to Sine
	ad9833_set_mode(AD_SINE);
	long i = 1,j=0;
	while (1) {


		ad9833_set_frequency(0,100e3);

		ad9833_set_frequency(0,90e3);
//
//		//hold here
//		if (j==1){ad9833_set_mode(AD_TRIANGLE);j=0;}
//		else {ad9833_set_mode(AD_SINE);j=1;}
//		for (i = 100; i < 100e3; i+=10) {
//
//			ad9833_set_frequency(0,i);
//		}
	}
	return 0;
}
